<?php

declare(strict_types=1);
/**
 * This file is part of MoChat.
 * @link     https://mo.chat
 * @document https://mochat.wiki
 * @contact  group@mo.chat
 * @license  https://github.com/mochat-cloud/mochat/blob/master/LICENSE
 */
namespace MoChat\Plugin\ContactStage\Job;

use Hyperf\AsyncQueue\Job;
use Hyperf\Logger\LoggerFactory;
use MoChat\App\WorkEmployee\Contract\WorkEmployeeContract;
use MoChat\Plugin\ContactStage\Contract\ContactStageEmployeeContract;
use Psr\Log\LoggerInterface;

/**
 * 根据企业id确认阶段.
 */
class SyncRemindByStageJob extends Job
{
    /**
     * @var array
     */
    public $params;

    /**
     * @var ContactStageEmployeeContract
     */
    protected $contactStageEmployeeService;

    /**
     * @var WorkEmployeeContract
     */
    protected $workEmployeeService;

    /**
     * @var LoggerInterface
     */
    private $logger;

    public function __construct(array $params)
    {
        $this->params = $params;
    }

    public function handle()
    {
        $stage = $this->params;
        $this->contactStageEmployeeService = make(ContactStageEmployeeContract::class);
        $this->workEmployeeService = make(WorkEmployeeContract::class);
        $loggerFactory = make(LoggerFactory::class);
        $this->logger = $loggerFactory->get(__CLASS__);

        $this->logger->debug(sprintf('阶段管理队列开始执行，阶段ID:%s', (string) $stage['id']));
        $employees = $this->workEmployeeService->getContactStagesByCorpId($stage['corpId'], ['id', 'wx_user_id']);

        foreach ($employees as $emp);
//            $contactStage = $this->contactStageEmployeeService->getContactStageEmployeeByStageId();
    }
}
